<#-- @ftlvariable name="receiveUserId" type="java.lang.String" -->
<#include "/_inc/_layout.ftl">
<#include "/_inc/_griddate.ftl">
<#assign allowCreate=helper.isAuthorize("SystemMessage.Create")/>
<#assign allowDelete=helper.isAuthorize("SystemMessage.Delete")/>
<@header/>
<#assign title = (receiveUserId??)?string('我的消息','系统消息')/>
<div id="gridtoolbar">
    <form id="gridform" class="jxlayout-form form-inline jxform">
        <input type="hidden" name="receiveUserId" value="${receiveUserId}">
        <div class="form-group">
            <input name="title" class="form-control w-200px" placeholder="请输入标题" autocomplete="off">
        </div>
        <div class="form-group">
            <select name="readStatus" class="jxselect form-control"
                    data-select-submit="true" data-allow-clear="false"
                    data-width="100">
                <@html.statusOptions emptyLable = "全部状态" enableLable = "已读" disableLable = "未读" selectedValue=0/>
            </select>
        </div>
        <div class="form-group ml-5">
            <div id="time-horizon" class="btn-group">
                <a class="btn btn-default" data-value="1">今天</a>
                <a class="btn btn-default" data-value="2">近7天</a>
                <a class="btn btn-default" data-value="3">近1个月</a>
                <a class="btn btn-default" data-value="4">近3个月</a>
                <a class="btn btn-default" data-value="5" data-toggle="popover-x"
                   data-placement="auto-bottom" data-target="#griddate-popover">
                    自定义
                </a>
            </div>
        </div>

        <button class="btn btn-primary ml-5" type="submit">
            <i class="fa fa-search"></i> 查询
        </button>
        <div class="btn-group">
            <#if !receiveUserId??>
                <@html.echo test=allowDelete>
                    <a id="btn-create" class="btn btn-default">
                        <i class="icon-plus"></i> 发送
                    </a>
                </@html.echo>
                <@html.echo test=allowDelete>
                    <a id="btn-delete" class="btn btn-default">
                        <i class="icon-trash"></i> 删除
                    </a>
                </@html.echo>
            </#if>
        </div>
    </form>
</div>
<@griddatepopover title="反馈日期"/>
<table id="grid" class="jxgrid" title="<i class='jxfs'></i> ${title}"
       data-options="form:'#gridform,#griddateform',toolbar:'#gridtoolbar',queryParams:{readStatus:0}"
       data-dialog-width="60%" data-dialog-height="68%">
    <thead>
    <tr>
        <th data-options="title:'标题',field:'title',width:300,align:'left'"></th>
        <th data-options="title:'接收人',field:'receiveUserName',width:100,align:'center'"></th>
        <th data-options="title:'状态',field:'readStatus',width:100,align:'center',sortable: true,formatter:jx.gf.status"></th>
        <th data-options="title:'接收时间',field:'readDatetime',width:150,align:'center'"></th>
        <th data-options="title:'发送人',field:'sendUserName',width:100,align:'center'"></th>
        <th data-options="title:'发送时间',field:'sendDateTime',width:150,align:'center'"></th>
    </tr>
    </thead>
</table>
<@footer>
    <script src="<@html.url '/auth/js/message.js'/>"></script>
</@footer>